home *** CD-ROM | disk | FTP | other *** search
- /* -----------------------------------------------------------------------------
-
- COPYIGHT
-
- ©1995 Dietmar Eilert (e-mail: DIETMAR@TOMATE.TNG.OCHE.DE). All Rights
- Reserved. Code may not be reused/reproduced without written permission of
- the author.
-
- Dietmar Eilert
- Mies-v-d-Rohe-Str.31, 52074 Aachen, Germany
- E-Mail: DIETMAR@TOMATE.TNG.OCHE.DE
- Tel: +49-(0)241-81665
- +49-(0)2525-7776
- Fax: +49-(0)241-81665
-
- Example: scan handler looking for AmigaGuide nodes (DICE-C). Scan handlers are
- plain functions loadSeg'ed by GED: no standard C startup code and no library
- calls.
-
- DICE C (-ms1 makes DICE compiler put string constants into code hunk):
-
- dcc guide.c -// -l0 -md -ms1 -mRR -o ram:guide
-
- ------------------------------------------------------------------------------
- */
-
- #include <exec/types.h>
-
- #define UPPER(a) ((a) & 95)
-
- ULONG
- ScanHandlerGuide(__D0 ULONG len, __A0 char **text, __A1 ULONG *line)
- {
- const char *version = "$VER: Guides 1.3 (" __COMMODORE_DATE__ ")";
-
- if (**text == '@') {
-
- if (len > 4) {
-
- UBYTE *next = *text + 1;
-
- if (UPPER(*next++) == 'N') {
-
- if (UPPER(*next++) == 'O') {
-
- if (UPPER(*next++) == 'D') {
-
- if (UPPER(*next++) == 'E') {
-
- UWORD letters = 0;
-
- for (len -= 5; len; --len) {
-
- if (*next == '"') {
-
- for (*text = ++next, --len; len && (*next != '"'); ++next)
- ++letters;
-
- return(letters);
- }
- else if (*next == ' ')
-
- next++;
-
- else {
-
- for (*text = next; len-- && (*next != ' ') && (*next != '"'); ++next)
- ++letters;
-
- return(letters);
- }
- }
-
- *text = "(unnamed)";
-
- return(9);
- }
- }
- }
- }
- }
- }
-
- return(FALSE);
- }
-